$(function () {
    //页面加载时获取交易对手 外证账户 债券三个下拉框
    $.ajax({
        async:false,
        type:"GET",
        dataType:"json",
        url:"/bond/index",
        success:function (result) {
            var _tradeParty = result.tradeParty;
            var _tradeInstrument = result.tradeInstrument
            var _secuAccount = result.secuAccount
            for (var i = 0 ;i < _tradeParty.length;i++){
                $("#tradeParty").append("<option value=\""+_tradeParty[i].partyID+"\" >"+_tradeParty[i].partyFullName+"</option>")
            }
            for (var i = 0; i < _tradeInstrument.length;i++){
                $("#tradeInstrument").append("<option value=\""+_tradeInstrument[i].iCode+"\">"+_tradeInstrument[i].iCode+"       "+_tradeInstrument[i].iName+"</option>")
            }
            for (var i = 0;i <  _secuAccount.length; i++){
                $("#secuAccount").append("<option value=\""+_secuAccount[i].secuCode+"\" >"+_secuAccount[i].secuCode+"    "+_secuAccount[i].secuName+"</option>")
            }
        }
    })

    setInterval("cal()","1000");

})
function cal(){
    var amount = parseFloat($("#couponAmount").val())*100
    var price = parseFloat($("#price").val())
    var dealPaySum;
    console.log(price)
    if (isNaN(amount) || isNaN(price)){
        dealPaySum = 0;
    }else {
        dealPaySum = amount*price
    }
    $("#dealPaySum").val(dealPaySum.toFixed(4).toString())

}
